﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Web.UI;
using System.ComponentModel;
using TA.DotNetUtils;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// BaseControl reference that is applied to multiple post scenarios, usually for controls that are essential to the operation of the whole application.
	/// </summary>
	public class GlobalControlReference : BaseControlReference
	{
		#region PUBLIC
		/// <summary>
		/// Ctor.
		/// </summary>
		public GlobalControlReference()
		{
			this._mpv = new MultiControlValue<PostScenario>(this);
			ScenariosMode = InclusionMode.AllExceptExcluded;
			Direction = ControlTransferDirection.Both;
		}
		#region PROPS
		/// <summary>
		/// Specifies who ScenarioIds/ScenarioIdList is used to determine the final list of scenarios.
		/// </summary>
		[DefaultValue(InclusionMode.AllExceptExcluded)]
		public InclusionMode ScenariosMode { get; set; }
		/// <summary>
		/// Comma-separated list of Ids of scenarios that will be included or excluded, depending on ScenariosMode.
		/// </summary>
		public string ScenarioIds
		{
			get
			{
				return _mpv.Value;
			}
			set
			{
				_mpv.Value = value;
			}
		}
		/// <summary>
		/// List of Ids of scenarios that will be included or excluded, depending on ScenariosMode.
		/// </summary>
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		[Browsable(false)]
		public List<string> ScenarioIdList
		{
			get
			{
				return _mpv.ValueList;
			}
		}
		/// <summary>
		/// List of scenarios that will be included or excluded, depending on ScenariosMode.
		/// </summary>
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		[Browsable(false)]
		public List<PostScenario> ScenarioList
		{
			get
			{
				return this._mpv.ControlList;
			}
		}
		/// <summary>
		/// The direction in which this control will be transferred.
		/// </summary>
		[DefaultValue(ControlTransferDirection.Both)]
		public ControlTransferDirection Direction
		{
			get;
			set;
		}
		#endregion
		#endregion
		#region INTERNAL
		#region VARS
		MultiControlValue<PostScenario> _mpv;
		#endregion
		#endregion
	}
}
